package main;

import java.util.ArrayList;
import java.util.LinkedList;
/*
 * Should contain all grids in the game
 */

import creatures.Dragon;
import creatures.DragonWhelp;
import creatures.ElfArcher;
import creatures.IceYeti;
import creatures.Wolf;
/*
 * contains all of the grids available in the game
 */
public class GameGrids {
	LinkedList<Grid> grids;
	ArrayList<Creature> enemies;
	boolean inCombat;
	public GameGrids(Player p){
		grids=new LinkedList<Grid>();

		//images
		String sand = "tiles/sand.jpg";
		String dock = "dock.png";
		String wolf = "creatures/wolf.gif";
		String yeti = "creatures/yeti.gif";
		String elfarcher = "creatures/elfarcher.gif";
		String dragon = "creatures/dragon.gif";
		String dragonwhelp = "creatures/dragonwhelp.gif";
		String pJobName = p.job.name;
		
		//intro grid 1
		enemies = new ArrayList<Creature>();
		
		enemies.add(new Creature(15,5,"sand",sand));
		enemies.get(0).x=15;
		enemies.get(0).y=5;
		
		enemies.add(new Creature(15,6,"sand",sand));
		enemies.get(1).x=15;
		enemies.get(1).y=6;
		
		enemies.add(new Creature(15,7,"sand",sand));
		enemies.get(2).x=15;
		enemies.get(2).y=7;
		
		enemies.add(new Creature(14,7,"sand",sand));
		enemies.get(3).x=14;
		enemies.get(3).y=7;
		
		enemies.add(new Creature(14,6,"dock",dock));
		enemies.get(4).x=14;
		enemies.get(4).y=6;
		
		int [] xWin = {13,13,13,14};
		int [] yWin = {5,6,7,6};
		
		Grid g = new Grid(16,12,2,0,6,xWin,yWin);
		g.tile="tiles/blueskyartpaper.jpg";
		g.creatures = enemies;
		g.creaturesToGrid();
		grids.add(g);
		
		//wintype 1=kill all, wintype 2=reach a square, wintype 3=kill boss
		
		//make first grid
		enemies=new ArrayList<Creature>();
		enemies.add(new Wolf(5,3,"Wolf 1",wolf));
		enemies.get(0).x=5;
		enemies.get(0).y=3;
		
		enemies.add(new Wolf(2,8,"Wolf 2",wolf));
		enemies.get(1).x=2;
		enemies.get(1).y=8;
		
		enemies.add(new Wolf(6,9,"Wolf 3",wolf));
		enemies.get(2).x=6;
		enemies.get(2).y=9;
		
		//String tile="tiles/dirt.jpg";/*"grass.gif"*/
		g = new Grid(16,12,1,1,2);
		
		//g.putOccupant(1, 2, p);
		g.tile="tiles/dirt.jpg";
		g.creatures = enemies;
		g.creaturesToGrid();
		grids.add(g);
		
		//make second grid
		enemies=new ArrayList<Creature>();
		enemies.add(new Wolf(5,3,"Wolf 1",wolf));
		enemies.get(0).x=5;
		enemies.get(0).y=3;

		enemies.add(new Wolf(2,8,"Wolf (Boss)",wolf));
		enemies.get(1).x=2;
		enemies.get(1).y=8;

		g = new Grid(16,12,3,5,6, (Enemy) enemies.get(1));

		//g.putOccupant(5, 6, p);
		g.creatures = enemies;
		g.tile="tiles/grass.jpg";
		g.creaturesToGrid();
		grids.add(g);
		
		//make third grid
		enemies=new ArrayList<Creature>();
		enemies.add(new ElfArcher(5,3,"Elf Archer",elfarcher));
		enemies.get(0).x=5;
		enemies.get(0).y=3;

		enemies.add(new Wolf(6,4,"Wolf",wolf));
		enemies.get(1).x=6;
		enemies.get(1).y=4;

		g = new Grid(16,12,1,1,10);

		//g.putOccupant(5, 6, p);
		g.creatures = enemies;
		g.tile="tiles/icy tile.jpg";
		g.creaturesToGrid();
		grids.add(g);
		
		//make fourth grid
		enemies=new ArrayList<Creature>();
		enemies.add(new ElfArcher(5,3,"Elf Archer",elfarcher));
		enemies.get(0).x=5;
		enemies.get(0).y=3;

		enemies.add(new Wolf(6,4,"Wolf",wolf));
		enemies.get(1).x=6;
		enemies.get(1).y=4;
		
		enemies.add(new Wolf(8,7,"Wolf",wolf));
		enemies.get(2).x=8;
		enemies.get(2).y=7;
		
		enemies.add(new IceYeti(5,6,"Ice Yeti(Boss)",yeti));
		enemies.get(3).x=5;
		enemies.get(3).y=6;

		g = new Grid(16,12,3,1,6,(Enemy) enemies.get(3));

		//g.putOccupant(5, 6, p);
		g.creatures = enemies;
		g.tile="tiles/icy tile.jpg";
		g.creaturesToGrid();
		grids.add(g);
		
		//make fifth grid
		enemies=new ArrayList<Creature>();
		enemies.add(new IceYeti(2,8,"Ice Yeti 1",yeti));
		enemies.get(0).x=2;
		enemies.get(0).y=8;

		enemies.add(new IceYeti(5,11,"Ice Yeti 2",yeti));
		enemies.get(1).x=5;
		enemies.get(1).y=11;
		
		enemies.add(new IceYeti(4,2,"Ice Yeti 3",yeti));
		enemies.get(2).x=4;
		enemies.get(2).y=2;
		
		enemies.add(new IceYeti(8,7,"Ice Yeti 4",yeti));
		enemies.get(3).x=8;
		enemies.get(3).y=7;

		g = new Grid(16,12,1,2,3);

		//g.putOccupant(5, 6, p);
		g.creatures = enemies;
		g.tile="tiles/icy tile.jpg";
		g.creaturesToGrid();
		grids.add(g);
		
		//make sixth grid
		enemies=new ArrayList<Creature>();
		enemies.add(new DragonWhelp(1,8,"Dragon Whelp 1",dragonwhelp));
		enemies.get(0).x=1;
		enemies.get(0).y=8;

		enemies.add(new DragonWhelp(9,5,"Dragon Whelp 2",dragonwhelp));
		enemies.get(1).x=9;
		enemies.get(1).y=5;
		
		enemies.add(new DragonWhelp(6,2,"Dragon Whelp 2",dragonwhelp));
		enemies.get(2).x=6;
		enemies.get(2).y=2;
		
		enemies.add(new Dragon(10,8,"Dragon(Boss)",dragon));
		enemies.get(3).x=10;
		enemies.get(3).y=8;

		g = new Grid(16,12,3,5,9,(Enemy) enemies.get(3));

		//g.putOccupant(5, 6, p);
		g.creatures = enemies;
		g.tile="tiles/rusted metal.jpg";
		g.creaturesToGrid();
		grids.add(g);
		
	}//end constructor
	
	public void setIconsForNextLevels(){
		
	}
	
	public Grid getGrid(int i){
		return grids.get(i);
	}//
}//end class
